﻿<%@ Page Language="C#" MasterPageFile="~/BluePortal.Master" AutoEventWireup="true" CodeBehind="CategoryForm.aspx.cs" Inherits="BluePortal.QuikStart.CategoryForm" Title="Category" %>
<asp:Content ID="Content1" ContentPlaceHolderID="DefaultContent" runat="server">
Manage Categories<br />
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
	<asp:Button ID="ButtonAdd" runat="server" Text="Add" 
	onclick="ButtonAdd_Click" />
    <br />
	<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
	DataSourceID="categoryDS">
		<columns>
			<asp:commandfield ShowEditButton="True"></asp:commandfield>
			<asp:commandfield ShowDeleteButton="True">
			</asp:commandfield>
			<asp:boundfield DataField="CID" HeaderText="CID" SortExpression="CID">
			</asp:boundfield>
			<asp:boundfield DataField="Name" HeaderText="Name" SortExpression="Name">
			</asp:boundfield>
		</columns>
	</asp:GridView>
	<br />Add Video to Category<br />Video :
	<asp:DropDownList ID="DropDownListVideo" runat="server" DataSourceID="videoDS" 
	DataTextField="Title" DataValueField="VID" AutoPostBack="True">
	</asp:DropDownList>
	
	<br />Category :<asp:DropDownList ID="DropDownListCategories" runat="server" 
	DataSourceID="categoryDS" DataTextField="Name" DataValueField="CID">
	</asp:DropDownList>
&nbsp;<asp:Button ID="ButtonADDcat" runat="server" Text="Add Category" 
	onclick="AddCategory2Video" /><br />
	<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
	DataSourceID="categoryForVideoDS">
		<columns>
			<asp:boundfield DataField="CID" HeaderText="CID" SortExpression="CID">
			</asp:boundfield>
			<asp:boundfield DataField="Name" HeaderText="Name" SortExpression="Name">
			</asp:boundfield>
			<asp:boundfield DataField="ParentCategory" HeaderText="ParentCategory" 
			SortExpression="ParentCategory">
			</asp:boundfield>
		</columns>
	</asp:GridView>
	<asp:ObjectDataSource ID="categoryForVideoDS" runat="server" 
	DeleteMethod="RemoveVideoFromCategory" InsertMethod="AddVideoToCategory" 
	SelectMethod="GetVideoCategories" 
	TypeName="BluePortal.Core.Services.VideoCategoryService">
		<deleteparameters>
			<asp:parameter Name="category" Type="Object" />
			<asp:parameter Name="video" Type="Object" />
		</deleteparameters>
		<selectparameters>
			<asp:controlparameter ControlID="DropDownListVideo" Name="videoID" 
			PropertyName="SelectedValue" Type="Object" />
		</selectparameters>
		<insertparameters>
			<asp:parameter Name="category" Type="Object" />
			<asp:parameter Name="videoID" Type="Object" />
		</insertparameters>
	</asp:ObjectDataSource>
	<asp:ObjectDataSource ID="categoryDS" runat="server" 
	DataObjectTypeName="BluePortal.Core.BusinessObjects.Category" 
	DeleteMethod="DeleteCategory" SelectMethod="FindAllCategories" 
	TypeName="BluePortal.Core.Services.VideoCategoryService" 
	UpdateMethod="UpdateCategory"></asp:ObjectDataSource>
	<asp:ObjectDataSource ID="videoDS" runat="server" SelectMethod="SelectAllVideo" 
	TypeName="BluePortal.Core.Services.VideoService"></asp:ObjectDataSource>
</asp:Content>
